//this class support interface that a concrete mutex should implement
//andycai_sc 2011-04-28

#ifndef GTHREADIMPL_H
#define GTHREADIMPL_H

#include "GParallel/GThread.h"

class GThreadImpl
{
public:
	virtual ~GThreadImpl() {}

	virtual void startImpl() = 0;
	virtual void stopImpl() = 0;
	virtual void joinImpl() = 0;

	void exec() { m_thread->run(); }

	typedef void sleepImpl(long mseconds);

	static sleepImpl* _sleepImpl;

protected:
	GThreadImpl(GThread* _thread) { m_thread = _thread; }

private:
	GThread* m_thread;
};

class GThreadImplCreator
{
public:
	static GThreadImpl* create(GThread* thr);
};

GThreadImpl* createThreadFromStl(GThread* thr);
GThreadImpl* createThreadFromBoost(GThread* thr);
GThreadImpl* createThreadFromPoco(GThread* thr);
GThreadImpl* createThreadFromAce(GThread* thr);
GThreadImpl* createThreadFromQt(GThread* thr);
GThreadImpl* createThreadFromGToy(GThread* thr);

#endif
